﻿using Microsoft.Maps.MapControl;
using MyFloridaHouse.ServiceConn.BingGeocodeService;
using Location = Microsoft.Maps.MapControl.Location;

namespace MyFloridaHouse.SilverlightOpenDistricts
{
    public class MapGeocodeLayer
    {
        private Map myMap;
        private MapLayer layer;


        public MapGeocodeLayer(Map _myMap)
        {
            myMap = _myMap;
            layer = new MapLayer();
            myMap.Children.Add(layer);
        }

		public Location AddResult(GeocodeResult result)
        {
            layer.Children.Clear();
            Pushpin pp = new Pushpin();
            Location loc = new Location(result.Locations[0].Latitude, result.Locations[0].Longitude);
            pp.Location = new Location(result.Locations[0].Latitude, result.Locations[0].Longitude);
            layer.Children.Add(pp);

            return loc;
        }
    }
}
